<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://shale.apache.org/core" prefix="s" %>

<html>
	<head>
		<title>"Bypass Validation" Sample Page</title>

		<script type="text/javascript">
			function bypassValidations() {
				document.getElementById('fld_bypassValidation').value='true';
			}
		</script>

	</head>
	<f:view>
	<body>
		<h:messages layout="list" id="messages1" styleClass="messages" showDetail="true" tooltip="true"></h:messages>
		<f:loadBundle var="lbl" basename="bundle/labels" />
		<f:loadBundle var="msg" basename="bundle/messages" />
		
		<h:form id="form1" onsubmit="return validateForm(this)">
			<table>
				<tbody>
				<tr>
					<td><h:outputLabel value="#{lbl.name}" /></td>
					<td>:</td>
					<td>
						<h:inputText id="txt_name" value="#{validatorPageBean.name}">
							<s:commonsValidator type="maxlength" arg="#{lbl.name}"  client="false" server="true" maxlength="8">
							</s:commonsValidator>
							<s:commonsValidator type="minlength" arg="#{lbl.name}"  client="false" server="true" minlength="2">
							</s:commonsValidator>
						</h:inputText>
			    	<td>
			    	<td>includes minlength=2 and maxlength=8 validators</td>
			    </tr>
				<tr>
					<td><h:outputLabel value="#{lbl.age}" /></td>
					<td>:</td>
					<td>
						<h:inputText id="txt_age" value="#{validatorPageBean.age}">
							<s:commonsValidator type="intRange" arg="#{lbl.age}" client="false" server="true" min="1" max="10">
							</s:commonsValidator>
					    </h:inputText>
			    	<td>
			    	<td>includes intRange (between 1 and 10) validator</td>
			    </tr>
			    </tbody>
			</table>
			
			<h:commandButton type="submit" value="Bypass All Validations" action="None"
				onclick="bypassValidations();">
			</h:commandButton>
			<h:commandButton type="submit" value="Don't Bypass Validations" action="None">
			</h:commandButton>

			<input type="hidden" id="fld_bypassValidation" name="fld_bypassValidation" value="false" />
			<s:validatorScript functionName="validateForm"/>
		</h:form>
		
	</body>
	</f:view>
</html>  
